<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8" %>
<%@ include file="/include/taglibs.jsp" %>
<html>
<head>
    <%@include file="/include/header.html"%>
    <script src="${ctx}/appjs/invoice/stationInvoice.js"></script>
    <link rel="stylesheet" href="${ctx}/statics/css/update.css?v=20200825">
    <link rel="stylesheet" href="${ctx}/statics/css/common.css?v=20200825">
    <link rel="stylesheet" href="${ctx}/libjs/plugins/bootstrap-table-pagejump/bootstrap-table-pagejump.css">
    <script src="${ctx}/libjs/plugins/bootstrap-table-pagejump/bootstrap-table-pagejump.js"></script>
    <%--<link rel="stylesheet" href="${ctx}/libjs/plugins/laydate/skins/laydate.css">--%>
    <link rel="stylesheet" href="${ctx}/libjs/plugins/laydate/laydate.css">
    <script src="${ctx}/libjs/plugins/laydate/laydate.js"></script>
    <style>
        .bootstrap-table .fixed-table-container .table thead th .th-inner{
            text-align: center !important;
        }
    </style>
</head>

<script type="text/javascript">
    $('#topLink', window.parent.document).html(function(i,origText){
        return'<ol class="breadcrumb">' +
            '<li class="breadcrumb-item">' +
            '<a href="">主页</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a>财务管理</a>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<strong>桩群发票</strong>' +
            '</li>' +
            '<li class="breadcrumb-item">' +
            '<a href="javascript:window.history.back()"><i class="fa fa-times"></i> 返回</a>' +
            '</li>' +
            '</ol>';
        });

    var has_add = '';
    var has_edit = '';
    var has_delete = '';
</script>

<body class="gray-bg">
	<div class="wrapper wrapper-content ">
		<div class="col-sm-12">
			<div class="ibox">
				<div class="ibox-body">
                    <div class="row">
                        <shiro:hasPermission name="FinanceManage_stationInvoice_reload">
                            <input id="stationName" name="stationName" type="text" class="form-control shortInput" placeholder="桩群名称">
                            <select class="form-control shortInput input-distance" name="equipmentHlhtOperatorId"
                                    id="equipmentHlhtOperatorId">
<%--                                <option value="" selected>设备运营商</option>--%>
                                <option value="tenantCode">${tenant.tenantName}</option>
                                <c:forEach items="${hlhtOperators}" var="hlhtOperator">
                                    <option value="${hlhtOperator.hlhtOperatorId}">${hlhtOperator.hlhtOperatorName}</option>
                                </c:forEach>
                                <c:forEach items="${tenantList}" var="tenant">
                                    <option value="${tenant.tenantCode}">${tenant.tenantName}</option>
                                </c:forEach>
                            </select>
                            <select class="form-control shortInput input-distance" name="orderType"
                                    id="orderType">
                                <option value="0">个人订单</option>
                                <option value="1">企业订单</option>
                                <option value="2">反向互联</option>
                            </select>
                            <input id="startTime" name="startTime" type="text" class="form-control shortInput input-distance" placeholder="开始时间">
                            <input id="endTime" name="endTime" type="text" class="form-control shortInput input-distance" placeholder="结束时间">
                            <button class="btn btn-success input-distance" onclick="stationInvoice.reLoad()">查询</button>
                        </shiro:hasPermission>
                        <shiro:hasPermission name="FinanceManage_stationInvoice_export">
                        <div class="pull-left search fr exportNumInput">
                            <input id="count" name="count" type="text" class="form-control"
                                   placeholder="导出条数">
                        </div>
                        <div class="pull-left search fr">
                            <button class="btn btn-success exportBtn" onclick="stationInvoice.exportStationInvoice()">导出</button>
                        </div>
                        </shiro:hasPermission>
                    </div>

                    <table id="exampleTable" data-mobile-responsive="true">
                    </table>
				</div>
			</div>
		</div>

	</div>
    <script type="text/javascript">
        $("#equipmentHlhtOperatorId").change(function () {
            var val=$(this).val();
            var str='';
            $("#orderType option").remove();
            if (val!="tenantCode" && val!=""){
                str+='<option value="0" selected>个人订单</option>';
                str+='<option value="1">企业订单</option>';
            } else {
                str+='<option value="0" selected>个人订单</option>';
                str+='<option value="1">企业订单</option>';
                str+='<option value="2">反向互联</option>';
            }
            $("#orderType").append(str);
        })
    </script>
    <script type="text/javascript">
        var thisDate = new Date();
        var year = thisDate.getFullYear();
        var month = thisDate.getMonth()+1;
        var date = thisDate.getDate();
        if(month<10){month = '0' + month}
        if(date<10){date = '0' + date}

        $('#startTime').val(year + '-' + month + '-' + date + ' ' + '00:00:00');

        $('#endTime').val(year + '-' + month + '-' + date + ' ' + '23:59:59');

        // //日期范围限制
        var start = {
            elem: '#startTime',
            format: 'YYYY-MM-DD hh:mm:ss',
            // theme: '#3195f0',
            // min: laydate.now(), //设定最小日期为当前日期
            // max: '2099-06-16 23:59:59', //最大日期
            istime: true,
            istoday: false,
            choose: function (datas) {
                $("#endTime").val("")
                end.min = datas
            }
        };
        var end = {
            elem: '#endTime',
            format: 'YYYY-MM-DD hh:mm:ss',
            // theme: '#3195f0',
            // min: laydate.now(),
            // max: '2099-06-16 23:59:59',
            istime: true,
            istoday: false,
            choose: function (datas) {
                start.max = datas; //结束日选好后，重置开始日的最大日期
            }
        };
        laydate(start);
        laydate(end);
        laydate.skin('molv');//皮肤

        stationInvoice.init();
    </script>
</body>

</html>
